﻿using System.Collections.Generic;
using System.ServiceModel;
using Dal;
namespace AtlantisService
{
    [ServiceBehavior]
    public class ServiceAtlantis : IAtlantis
    {
        IMusicDataAccess db { get; set; }

        public ServiceAtlantis()
        {
            db = new MusicDataAccess();
        }

        #region IAtlantis Members

        [OperationBehavior]
        public void InsertTags(string password, List<string> tags)
        {
            if (password == "nekojalozinka")
                db.InsertTags(tags);
        }

        [OperationBehavior]
        public Tag GetTag(string password, string tagName)
        {
            if (password == "nekojalozinka")
                return db.GetTag(tagName);
            else
                return null;
        }

        [OperationBehavior]
        public List<Tag> GetTagStatus(string password, List<Tag> tags)
        {
            if (password == "nekojalozinka")
                return db.GetTagStatus(tags);
            else
                return null;
        }

        [OperationBehavior]
        public Wrapper GetStories(string password, int skip, int take, Wrapper wrapper)
        {
            if (password == "nekojalozinka")
                return db.GetStories(skip, take, wrapper);
            else
                return null;
        }

        [OperationBehavior]
        public Wrapper UpdateStories(string password, Wrapper wrapper)
        {
            if (password == "nekojalozinka")
                return db.UpdateStories(wrapper);
            else
                return null;
        }

        [OperationBehavior]
        public int SubmitBotBillBoard(string password, string songName, int category, string description, string artistName)
        {
            if (password == "nekojalozinka")
                return db.SubmitBotBillBoard(songName, category, description, artistName);
            else
                return 0;
        }

        [OperationBehavior]
        public List<ARTIST> GetArtists(string password, int take, int skip)
        {
            if (password == "nekojalozinka")
                return db.GetArtists(take, skip);
            else
                return null;
        }

        [OperationBehavior]
        public int SubmitBotLastFM(string password, List<Story> songs)
        {
            if (password == "nekojalozinka")
                return db.SubmitBotLastFM(songs);
            else
                return 0;
        }

        [OperationBehavior]
        public void SetArtistSongless(string password, ARTIST artist)
        {
            if (password == "nekojalozinka")
                db.SetArtistSongless(artist);
        }

        #endregion
    }
}
